package com.maimao.model.info;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 优惠券-用户
 *
 * @author MaoLin Wang
 * @date 2020/11/28 10:49 上午
 */
@Setter
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("mm_coupon_user")
public class CouponUser implements Serializable {

    private static final long serialVersionUID = 3437992415227005205L;

    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("user_id")
    private Long userId;

    @TableField("coupon_id")
    private Long couponId;

    @TableField("start_time")
    private LocalDateTime startTime;

    @TableField("end_time")
    private LocalDateTime endTime;

    /**
     * 1 正常 2 过期 3 禁用(系统或商家取消了优惠券)
     */
    @TableField("`status`")
    private Integer status;

    @TableField("used_time")
    private LocalDateTime usedTime;

    @TableField("order_id")
    private Long orderId;

    /**
     * 是否使用 提交订单时改为使用 付款后该优惠券直接删除
     */
    private Boolean used;


    @Override
    public String toString() {
        return "CouponUser{" +
                "id=" + id +
                ", userId=" + userId +
                ", couponId=" + couponId +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                ", status=" + status +
                ", usedTime=" + usedTime +
                ", orderId=" + orderId +
                ", used=" + used +
                '}';
    }
}
